<template>
	<view class="jobDetail">
		<view class="">
			<view class="title">
				{{candidates.name}}的资料
			</view>
			<view class="infoBox">
				<view class="infoItem">
					<text class="left">姓名</text>
					<text class="right">{{candidates.name}}</text>
				</view>
				<view class="infoItem">
					<text class="left">性别</text>
					<text class="right" v-if="candidates.gender==0">男</text>
					<text class="right" v-if="candidates.gender==1">女</text>
				</view>
				<view class="infoItem">
					<text class="left">所在城市</text>
					<text class="right" >{{candidates.tbCity.cityName}}</text>
				</view>
				<view class="infoItem">
					<text class="left">生日</text>
					<text class="right">{{candidates.birthday}}</text>
				</view>
				<view class="infoItem">
					<text class="left">期望工种</text>
					<text class="right">{{candidates.tbOccupation.name}}</text>
				</view>
				<view class="infoItem">
					<text class="left">地址</text>
					<text class="right">{{candidates.address}}</text>
				</view>
				<view class="infoItem">
					<text class="left salary">期望薪资</text>
					<text class="right salary">{{ candidates.wantSalary+'k'}}</text>
				</view>
			</view>
			<view class="descBox">
				<view class="title2">
					自我介绍
				</view>
				<view class="desc" >
					{{candidates.selfIntroduction==null ?"":candidates.selfIntroduction}}
				</view>
			</view>
		</view>
		<button type="default" @tap="jumpChatPrivate()">联系求职者</button>
	</view>
</template>

<script>
	import {
		Toast
	} from '../../common/common.js'
	import {findByCandidateId} from "../../api/user.js"
	import {getCandidatesById} from "../../api/enterprise.js"
	export default {
		data() {
			return {
				candidatesId: 0,
				candidates: {},
				user:{}
			}
		},
		onLoad(options) {
			this.candidatesId = options.jobId || 0
			this.findByCandidateId()
			this.getCandidatesById()
		},
		onShow() {
		},
		methods: {
			getCandidatesById(){
				getCandidatesById({"id":this.candidatesId}).then(res=>{
					this.candidates = res.data.data
				})
			},
			findByCandidateId(){
				findByCandidateId({"id":this.candidatesId }).then(res=>{
					this.user = res.data.data
					getApp().globalData.friend = this.user
				})
			},
			jumpChatPrivate() {
				uni.navigateTo({
					url:`/pages/chat/privateChat?to=${this.user.id}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.jobDetail {
		min-height: 100vh;

		.bgImg {
			width: 100%;
			height: 200rpx;
			background: #F1F1F1;
		}

		.companyName {
			color: red;
			margin-bottom: 20upx;
			font-size: 32upx;
			font-weight: 600;
			text-align: center;
		}

		.number {
			margin-bottom: 20upx;
			font-size: 30upx;
			color: #999;
			text-align: center;
			padding-bottom: 30upx;
			border-bottom: 2upx solid #f4f4f4;
		}

		.title {
			color: red;
			margin-top: 30upx;
			margin-bottom: 30upx;
			font-size: 32upx;
			font-weight: 600;
			text-align: center;
		}

		.infoBox {
			background: #FFFFFF;
			padding: 30upx;
			padding-top: 0;

			.infoItem {
				display: flex;
				justify-content: space-between;
				padding: 30upx 0;
				border-bottom: 2upx solid #f4f4f4;

				.left {
					color: #343434;
				}

				.right {
					color: #999;
				}

				.salary {
					color: red;
					font-weight: 600;
				}
			}

			.infoItem2 {
				padding: 30upx 0;
				border-bottom: 2upx solid #f4f4f4;
				display: block;
			}
		}

		.descBox {
			background: #FFFFFF;
			padding: 30upx;
			padding-top: 0;
			margin-bottom: 30upx;
			border-bottom: 2upx solid #f4f4f4;

			.title2 {
				font-weight: 600;
				font-size: 32upx;
				margin-bottom: 30upx;
				color: #343434;
			}

			.desc {
				font-size: 28upx;
				line-height: 48upx;
				color: #343434;
			}
		}

		.companyImg {
			width: 300upx;
			height: 200upx;
			margin: 0 30upx;
		}
	}
</style>
